/**
* Class Name: IFulfillQueryRequestRoundRobinTest 
* Author: Accenture
* Date: 02-Nov-2011
* Requirement/Project Name: iFulfill
* Requirement/Project Description: Test class for IFulfillQueryRequestRoundRobin
**/

@istest
private class IFulfillQueryRequestRoundRobinTest 
{
    /**
    *  Test method. 
    *
    */
    public static testmethod  void testQueryRequestObjects()
    {
         Profile p = [select id from profile where name='System Administrator'];         
        User mgrUser  = new User(alias = 'sysmgr', email='sysadmin@accenture.com',emailencodingkey='UTF-8', lastname='testMgr', languagelocalekey='en_US',localesidkey='en_US', profileid = p.Id,timezonesidkey='Asia/Calcutta', username='manager@testorg.com');           
        insert mgrUser;
        User u = new User(alias = 'sysad', email='sysadmin@accenture.com',emailencodingkey='UTF-8', lastname='Tes12', languagelocalekey='en_US',localesidkey='en_US', profileid = p.Id,timezonesidkey='Asia/Calcutta', username='testad123@testorg.com' ,managerID= mgrUser.id);           
        Insert u; 
        
        Fullfilment_Item__c FI4 = new Fullfilment_Item__c(Product_Family__c = 'Banner' ,Main_Listing_Phone_Number__c = '104560',Listed_Name__c ='XIne',Heading_Name__c ='Test Get grouped',Item_Id__c = 'Item id123' ,Product_Code__c ='p1',UDAC__c ='Udac1',Region__c = 'region1',Transaction_Type__c ='New', ownerid = u.id,group_id__c =2);
        insert FI4 ;
        Query_Reason_Code__c qryReasonCode  = new Query_Reason_Code__c( Product_Family__c = 'Banner' , Reason_Code__c = 'Dead Link');
        insert   qryReasonCode;
        Fullfilment_Item__c F = [select ownerID from  Fullfilment_Item__c  where id = :FI4.id ];
        F.ownerID = u.id;
        update f;
        
        Query_Request__c qr = new  Query_Request__c(Fulfillment_Item__c = FI4.ID,Request_Comments__c='Test Comment',Request_Reason__c= 'Reason 1');
        insert qr;
        
        Queries__c  qry = new  Queries__c(  Query_Request_ID__c = qr.id ,Query_code__c='0845 � PAS � PAS Appointment not setUndo' , Override_Sales_Rep__c= true , Sales_Rep_Name1__c =u.id );
        insert qry;



         Set<ID> s = new Set<ID>();        
         s.add(qr.id);
         IFulfillQueryRequestRoundRobin.getOwnerIDOfQueryRequest(s);       
         IFulfillQueryRequestRoundRobin.getAssignmentGroupsMembers(s);
         IFulfillQueryRequestRoundRobin.getAssignmentGroup(s);

    }
}